package com.zj.leetcode.easy;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: algorithm
 * @description:
 * @author: Zhang Bo
 * @create: 2022-01-13 16:02
 **/
public class FizzBuzz {
    public static void main(String[] args) {
        int n = 15;
        Solution solution = new FizzBuzz().new Solution();
        System.out.println(solution.fizzBuzz(n));
    }

    //leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        public List<String> fizzBuzz(int n) {
            List<String> list = new ArrayList<String>(n);

            for (int i = 0; i < n; i++) {
                int num = i + 1;
                if (num % 3 == 0 && num % 5 == 0) {
                    list.add(i, "FizzBuzz");
                } else if (num % 3 == 0) {
                    list.add(i, "Fizz");
                } else if (num % 5 == 0) {
                    list.add(i, "Buzz");
                } else {
                    list.add(i, String.valueOf(num));
                }

            }
            return list;
        }
    }
//leetcode submit region end(Prohibit modification and deletion)

}
